<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv='Content-Type' content='text/html; charset=utf-8'>
<title>Coverage for c:\program files\python26\lib\bisect</title>
<link rel='stylesheet' href='style.css' type='text/css'>
<script type='text/javascript' src='jquery-1.3.2.min.js'></script>
<script type='text/javascript'>
function toggle_lines(btn, cls) {
    var btn = $(btn);
    var hide = "hide_"+cls;
    if (btn.hasClass(hide)) {
        $("#source ."+cls).removeClass(hide);
        btn.removeClass(hide);
    }
    else {
        $("#source ."+cls).addClass(hide);
        btn.addClass(hide);
    }
}
</script>
</head>
<body>
<div id='header'>
    <div class='content'>
        <h1>Coverage for <b>c:\program files\python26\lib\bisect</b> :
            <span class='pc_cov'>10%</span>
        </h1>
        <h2 class='stats'>
            46 statements
            <span class='run hide_run' onclick='toggle_lines(this, "run")'>8 run</span>
            <span class='exc' onclick='toggle_lines(this, "exc")'>0 excluded</span>
            <span class='mis' onclick='toggle_lines(this, "mis")'>38 missing</span>
            
                <span class='par run hide_run' onclick='toggle_lines(this, "par")'>0 partial</span>
            
        </h2>
    </div>
</div>

<div id='source'>
<table cellspacing='0' cellpadding='0'>
<tr>
<td class='linenos' valign='top'>
<p class='pln'>1</p>
<p class='pln'>2</p>
<p class='stm run hide_run'>3</p>
<p class='pln'>4</p>
<p class='pln'>5</p>
<p class='pln'>6</p>
<p class='pln'>7</p>
<p class='pln'>8</p>
<p class='pln'>9</p>
<p class='pln'>10</p>
<p class='pln'>11</p>
<p class='stm mis'>12</p>
<p class='stm mis'>13</p>
<p class='stm mis'>14</p>
<p class='stm mis'>15</p>
<p class='stm mis'>16</p>
<p class='stm mis'>17</p>
<p class='stm mis'>18</p>
<p class='stm mis'>19</p>
<p class='stm mis'>20</p>
<p class='pln'>21</p>
<p class='stm run hide_run'>22</p>
<p class='pln'>23</p>
<p class='stm run hide_run'>24</p>
<p class='pln'>25</p>
<p class='pln'>26</p>
<p class='pln'>27</p>
<p class='pln'>28</p>
<p class='pln'>29</p>
<p class='pln'>30</p>
<p class='pln'>31</p>
<p class='pln'>32</p>
<p class='pln'>33</p>
<p class='pln'>34</p>
<p class='stm mis'>35</p>
<p class='stm mis'>36</p>
<p class='stm mis'>37</p>
<p class='stm mis'>38</p>
<p class='stm mis'>39</p>
<p class='stm mis'>40</p>
<p class='stm mis'>41</p>
<p class='stm mis'>42</p>
<p class='stm mis'>43</p>
<p class='pln'>44</p>
<p class='stm run hide_run'>45</p>
<p class='pln'>46</p>
<p class='stm run hide_run'>47</p>
<p class='pln'>48</p>
<p class='pln'>49</p>
<p class='pln'>50</p>
<p class='pln'>51</p>
<p class='pln'>52</p>
<p class='pln'>53</p>
<p class='pln'>54</p>
<p class='pln'>55</p>
<p class='stm mis'>56</p>
<p class='stm mis'>57</p>
<p class='stm mis'>58</p>
<p class='stm mis'>59</p>
<p class='stm mis'>60</p>
<p class='stm mis'>61</p>
<p class='stm mis'>62</p>
<p class='stm mis'>63</p>
<p class='stm mis'>64</p>
<p class='pln'>65</p>
<p class='pln'>66</p>
<p class='stm run hide_run'>67</p>
<p class='pln'>68</p>
<p class='pln'>69</p>
<p class='pln'>70</p>
<p class='pln'>71</p>
<p class='pln'>72</p>
<p class='pln'>73</p>
<p class='pln'>74</p>
<p class='pln'>75</p>
<p class='pln'>76</p>
<p class='pln'>77</p>
<p class='stm mis'>78</p>
<p class='stm mis'>79</p>
<p class='stm mis'>80</p>
<p class='stm mis'>81</p>
<p class='stm mis'>82</p>
<p class='stm mis'>83</p>
<p class='stm mis'>84</p>
<p class='stm mis'>85</p>
<p class='stm mis'>86</p>
<p class='pln'>87</p>
<p class='pln'>88</p>
<p class='stm run hide_run'>89</p>
<p class='stm run hide_run'>90</p>
<p class='stm mis'>91</p>
<p class='stm mis'>92</p>
    
</td>
<td class='text' valign='top'>
<p class='pln'><span class='str'>&quot;&quot;&quot;Bisection algorithms.&quot;&quot;&quot;</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'><span class='key'>def</span> <span class='nam'>insort_right</span><span class='op'>(</span><span class='nam'>a</span><span class='op'>,</span> <span class='nam'>x</span><span class='op'>,</span> <span class='nam'>lo</span><span class='op'>=</span><span class='num'>0</span><span class='op'>,</span> <span class='nam'>hi</span><span class='op'>=</span><span class='nam'>None</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='pln'>&nbsp; &nbsp; <span class='str'>&quot;&quot;&quot;Insert item x in list a, and keep it sorted assuming a is sorted.</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>&nbsp; &nbsp; If x is already in a, insert it to the right of the rightmost x.</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>&nbsp; &nbsp; Optional args lo (default 0) and hi (default len(a)) bound the</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>&nbsp; &nbsp; slice of a to be searched.</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>&nbsp; &nbsp; &quot;&quot;&quot;</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>lo</span> <span class='op'>&lt;</span> <span class='num'>0</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>raise</span> <span class='nam'>ValueError</span><span class='op'>(</span><span class='str'>&#39;lo must be non-negative&#39;</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>hi</span> <span class='key'>is</span> <span class='nam'>None</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>hi</span> <span class='op'>=</span> <span class='nam'>len</span><span class='op'>(</span><span class='nam'>a</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; <span class='key'>while</span> <span class='nam'>lo</span> <span class='op'>&lt;</span> <span class='nam'>hi</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>mid</span> <span class='op'>=</span> <span class='op'>(</span><span class='nam'>lo</span><span class='op'>+</span><span class='nam'>hi</span><span class='op'>)</span><span class='op'>//</span><span class='num'>2</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>x</span> <span class='op'>&lt;</span> <span class='nam'>a</span><span class='op'>[</span><span class='nam'>mid</span><span class='op'>]</span><span class='op'>:</span> <span class='nam'>hi</span> <span class='op'>=</span> <span class='nam'>mid</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>else</span><span class='op'>:</span> <span class='nam'>lo</span> <span class='op'>=</span> <span class='nam'>mid</span><span class='op'>+</span><span class='num'>1</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; <span class='nam'>a</span><span class='op'>.</span><span class='nam'>insert</span><span class='op'>(</span><span class='nam'>lo</span><span class='op'>,</span> <span class='nam'>x</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'><span class='nam'>insort</span> <span class='op'>=</span> <span class='nam'>insort_right</span>&nbsp;&nbsp; <span class='com'># backward compatibility</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'><span class='key'>def</span> <span class='nam'>bisect_right</span><span class='op'>(</span><span class='nam'>a</span><span class='op'>,</span> <span class='nam'>x</span><span class='op'>,</span> <span class='nam'>lo</span><span class='op'>=</span><span class='num'>0</span><span class='op'>,</span> <span class='nam'>hi</span><span class='op'>=</span><span class='nam'>None</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='pln'>&nbsp; &nbsp; <span class='str'>&quot;&quot;&quot;Return the index where to insert item x in list a, assuming a is sorted.</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>&nbsp; &nbsp; The return value i is such that all e in a[:i] have e &lt;= x, and all e in</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>&nbsp; &nbsp; a[i:] have e &gt; x.&nbsp; So if x already appears in the list, a.insert(x) will</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>&nbsp; &nbsp; insert just after the rightmost x already there.</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>&nbsp; &nbsp; Optional args lo (default 0) and hi (default len(a)) bound the</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>&nbsp; &nbsp; slice of a to be searched.</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>&nbsp; &nbsp; &quot;&quot;&quot;</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>lo</span> <span class='op'>&lt;</span> <span class='num'>0</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>raise</span> <span class='nam'>ValueError</span><span class='op'>(</span><span class='str'>&#39;lo must be non-negative&#39;</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>hi</span> <span class='key'>is</span> <span class='nam'>None</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>hi</span> <span class='op'>=</span> <span class='nam'>len</span><span class='op'>(</span><span class='nam'>a</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; <span class='key'>while</span> <span class='nam'>lo</span> <span class='op'>&lt;</span> <span class='nam'>hi</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>mid</span> <span class='op'>=</span> <span class='op'>(</span><span class='nam'>lo</span><span class='op'>+</span><span class='nam'>hi</span><span class='op'>)</span><span class='op'>//</span><span class='num'>2</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>x</span> <span class='op'>&lt;</span> <span class='nam'>a</span><span class='op'>[</span><span class='nam'>mid</span><span class='op'>]</span><span class='op'>:</span> <span class='nam'>hi</span> <span class='op'>=</span> <span class='nam'>mid</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>else</span><span class='op'>:</span> <span class='nam'>lo</span> <span class='op'>=</span> <span class='nam'>mid</span><span class='op'>+</span><span class='num'>1</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; <span class='key'>return</span> <span class='nam'>lo</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'><span class='nam'>bisect</span> <span class='op'>=</span> <span class='nam'>bisect_right</span>&nbsp;&nbsp; <span class='com'># backward compatibility</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'><span class='key'>def</span> <span class='nam'>insort_left</span><span class='op'>(</span><span class='nam'>a</span><span class='op'>,</span> <span class='nam'>x</span><span class='op'>,</span> <span class='nam'>lo</span><span class='op'>=</span><span class='num'>0</span><span class='op'>,</span> <span class='nam'>hi</span><span class='op'>=</span><span class='nam'>None</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='pln'>&nbsp; &nbsp; <span class='str'>&quot;&quot;&quot;Insert item x in list a, and keep it sorted assuming a is sorted.</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>&nbsp; &nbsp; If x is already in a, insert it to the left of the leftmost x.</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>&nbsp; &nbsp; Optional args lo (default 0) and hi (default len(a)) bound the</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>&nbsp; &nbsp; slice of a to be searched.</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>&nbsp; &nbsp; &quot;&quot;&quot;</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>lo</span> <span class='op'>&lt;</span> <span class='num'>0</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>raise</span> <span class='nam'>ValueError</span><span class='op'>(</span><span class='str'>&#39;lo must be non-negative&#39;</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>hi</span> <span class='key'>is</span> <span class='nam'>None</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>hi</span> <span class='op'>=</span> <span class='nam'>len</span><span class='op'>(</span><span class='nam'>a</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; <span class='key'>while</span> <span class='nam'>lo</span> <span class='op'>&lt;</span> <span class='nam'>hi</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>mid</span> <span class='op'>=</span> <span class='op'>(</span><span class='nam'>lo</span><span class='op'>+</span><span class='nam'>hi</span><span class='op'>)</span><span class='op'>//</span><span class='num'>2</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>a</span><span class='op'>[</span><span class='nam'>mid</span><span class='op'>]</span> <span class='op'>&lt;</span> <span class='nam'>x</span><span class='op'>:</span> <span class='nam'>lo</span> <span class='op'>=</span> <span class='nam'>mid</span><span class='op'>+</span><span class='num'>1</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>else</span><span class='op'>:</span> <span class='nam'>hi</span> <span class='op'>=</span> <span class='nam'>mid</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; <span class='nam'>a</span><span class='op'>.</span><span class='nam'>insert</span><span class='op'>(</span><span class='nam'>lo</span><span class='op'>,</span> <span class='nam'>x</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'><span class='key'>def</span> <span class='nam'>bisect_left</span><span class='op'>(</span><span class='nam'>a</span><span class='op'>,</span> <span class='nam'>x</span><span class='op'>,</span> <span class='nam'>lo</span><span class='op'>=</span><span class='num'>0</span><span class='op'>,</span> <span class='nam'>hi</span><span class='op'>=</span><span class='nam'>None</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='pln'>&nbsp; &nbsp; <span class='str'>&quot;&quot;&quot;Return the index where to insert item x in list a, assuming a is sorted.</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>&nbsp; &nbsp; The return value i is such that all e in a[:i] have e &lt; x, and all e in</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>&nbsp; &nbsp; a[i:] have e &gt;= x.&nbsp; So if x already appears in the list, a.insert(x) will</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>&nbsp; &nbsp; insert just before the leftmost x already there.</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>&nbsp; &nbsp; Optional args lo (default 0) and hi (default len(a)) bound the</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>&nbsp; &nbsp; slice of a to be searched.</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='str'>&nbsp; &nbsp; &quot;&quot;&quot;</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>lo</span> <span class='op'>&lt;</span> <span class='num'>0</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>raise</span> <span class='nam'>ValueError</span><span class='op'>(</span><span class='str'>&#39;lo must be non-negative&#39;</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>hi</span> <span class='key'>is</span> <span class='nam'>None</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>hi</span> <span class='op'>=</span> <span class='nam'>len</span><span class='op'>(</span><span class='nam'>a</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; <span class='key'>while</span> <span class='nam'>lo</span> <span class='op'>&lt;</span> <span class='nam'>hi</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>mid</span> <span class='op'>=</span> <span class='op'>(</span><span class='nam'>lo</span><span class='op'>+</span><span class='nam'>hi</span><span class='op'>)</span><span class='op'>//</span><span class='num'>2</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>a</span><span class='op'>[</span><span class='nam'>mid</span><span class='op'>]</span> <span class='op'>&lt;</span> <span class='nam'>x</span><span class='op'>:</span> <span class='nam'>lo</span> <span class='op'>=</span> <span class='nam'>mid</span><span class='op'>+</span><span class='num'>1</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>else</span><span class='op'>:</span> <span class='nam'>hi</span> <span class='op'>=</span> <span class='nam'>mid</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; <span class='key'>return</span> <span class='nam'>lo</span><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='strut'>&nbsp;</span></p>
<p class='pln'><span class='com'># Overwrite above definitions with a fast C implementation</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'><span class='key'>try</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm run hide_run'>&nbsp; &nbsp; <span class='key'>from</span> <span class='nam'>_bisect</span> <span class='key'>import</span> <span class='nam'>bisect_right</span><span class='op'>,</span> <span class='nam'>bisect_left</span><span class='op'>,</span> <span class='nam'>insort_left</span><span class='op'>,</span> <span class='nam'>insort_right</span><span class='op'>,</span> <span class='nam'>insort</span><span class='op'>,</span> <span class='nam'>bisect</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'><span class='key'>except</span> <span class='nam'>ImportError</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
<p class='stm mis'>&nbsp; &nbsp; <span class='key'>pass</span><span class='strut'>&nbsp;</span></p>
    
</td>
</tr>
</table>
</div>

</body>
</html>
